<template>
  <div>
    <div class="label" v-if="title==newtime">今天</div>
          <div class="labels" v-if="title==forstime">明天</div>
          <p style="margin-left:30rpx;padding-top:30rpx;">{{title}}</p>
          <ul style="padding:13px">
            <li class="data-li" v-for="(itemName, idx) of content" :key="idx" style="display:flex;position: relative;" @click="upke(content[idx])">
               <div class="lab2" v-show="content[idx].type=='请假'">请假</div>
              <div style="flex:1;position: relative;margin:auto;">
                <img
                  :src="content[idx].img"
                  alt
                  style="width:100rpx;height:100rpx;top: 0;right: 0;bottom: 0;left: 0;margin: auto;"
                />
              </div>
              <div style="flex:3.1;">
                <p style="margin-bottom:5%;display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;">{{content[idx].title}}</p>

                <div style="display:flex;">
                  <p style="flex:1.1;">{{content[idx].schooltime}}</p>
                  <p style="flex:1;text-align:center;">{{content[idx].classban}}</p>
                </div>
              </div>
            </li>
          </ul>
  </div>
</template>
<script>
export default {
  data(){
    return {
      newtime: '',
      forstime: '',
    }
  },
  props: {
    title: String,
    content: Array,

  },
    mounted() {
    this.start();
  },
  methods: {
        upke(v){
          console.log(v)
      wx.navigateTo({
        url: `../../pages/webview/main?schoolclazzstudentcalendarID=${v.schoolclazzstudentcalendarID}&id=${v.key}&classban=${v.classban}&data=${v.title}&schooltime=${v.schooltime}&start=${new Date(v.start).toLocaleDateString()}&teacher=${v.teacher}&hour=${v.hours}&type=${v.type}&schooluserids=${v.schooluserids}&info=${v.info}`
      });
    },
    start(){
       const fortime= Date.parse(new Date())+24*60*60*1000
       var weeks
    if(new Date(fortime).getDay() == 0) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期日"
    if(new Date(fortime).getDay() == 1) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期一"
    if(new Date(fortime).getDay() == 2) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期二"
    if(new Date(fortime).getDay() == 3) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期三"
    if(new Date(fortime).getDay() == 4) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期四"
    if(new Date(fortime).getDay() == 5) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+"星期五"
    if(new Date(fortime).getDay() == 6) weeks =new Date(fortime).getFullYear()+ '年' +(new Date(fortime).getMonth() + 1) + '月' +new Date(fortime).getDate() +'日'+'   '+ "星期六"
    this.forstime=weeks
       var week
    if(new Date().getDay() == 0) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期日"
    if(new Date().getDay() == 1) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期一"
    if(new Date().getDay() == 2) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期二"
    if(new Date().getDay() == 3) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期三"
    if(new Date().getDay() == 4) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期四"
    if(new Date().getDay() == 5) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+"星期五"
    if(new Date().getDay() == 6) week =new Date().getFullYear()+ '年' +(new Date().getMonth() + 1) + '月' +new Date().getDate() +'日'+'   '+ "星期六"
    this.newtime=week
    },
  }
};
</script>
<style>
.data-li {
  border: 1px solid black;
  border-radius: 5px;
  margin: 20rpx;
  padding:40rpx;
}
.lab2{
font-size:23rpx;
color:#ffffff;
line-height:46rpx;
background:red;
position:absolute;
right:0;
z-Index:2;
top:0;
padding:0 2em;
border-radius: 2px;
}
.label{
font-size:13px;
color:#ffffff;
line-height:38px;
background:red;
position:absolute;
right:0;
z-Index:2;
padding:0 2em;
-webkit-transform-origin:left bottom;
-moz-transform-origin:left bottom;
transform-origin:left bottom;
-webkit-transform:translate(29.29%,-100%) rotate(45deg);
-moz-transform:translate(29.29%,-100%) rotate(45deg);
transform:translate(29.29%,-100%) rotate(45deg);
text-indent:0;
}
.labels{
font-size:13px;
color:#ffffff;
line-height:38px;
background:orange;
position:absolute;
right:0;
z-Index:2;
padding:0 2em;
-webkit-transform-origin:left bottom;
-moz-transform-origin:left bottom;
transform-origin:left bottom;
-webkit-transform:translate(29.29%,-100%) rotate(45deg);
-moz-transform:translate(29.29%,-100%) rotate(45deg);
transform:translate(29.29%,-100%) rotate(45deg);
text-indent:0;
}
</style>
